<template>
  <div id="app">
    <h1>父组件</h1>
    <Son ref="sonA" />
  </div>
</template>

<script>
import Son from "./components/Son";
/* ref DOM对象 this.refs获取   ref也可绑定到子组件上，指向绑定的组件对象 子传父*/
export default {
  name: "App",
  data() {
    return {
      aaa: "app"
    };
  },
  components: {
    Son
  },
  mounted() {
    // 子传父
    console.log(this.$refs);
    console.log(this.$refs.sonA.msg);
    this.$refs.sonA.sum(1, 2);
  }
};
</script>

<style></style>
